home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGNG_C / TCXL21.LZH / TCXL.H < prev    next >
Text File  |  1988-01-24  |  9KB  |  204 lines

  1. /*----------------------------------------------------------------------------
  2.     TCXL.H - by Mike Smedley.
  3.     This file is a header file used to declare function
  4.     prototypes and macro definitions.  It is called by
  5.     the line:  #include "tcxl.h"
  6. ----------------------------------------------------------------------------*/
  7.  
  8. #ifdef __STDC__
  9. #define _Cdecl
  10. #else
  11. #define _Cdecl cdecl
  12. #endif
  13.  
  14. void     _Cdecl beep(void);
  15. char    *_Cdecl biosver(void);
  16. void     _Cdecl box(int srow,int scol,int erow,int ecol,int btype,int atr);
  17. void     _Cdecl boxd(int srow,int scol,int erow,int ecol,int btype,int atr);
  18. int      _Cdecl clockcal(void);
  19. void     _Cdecl clreol_(void);
  20. void     _Cdecl clrscrn(void);
  21. void     _Cdecl delay_(unsigned duration);
  22. unsigned _Cdecl extmem(void);
  23. int      _Cdecl fcmpdatm(char *fname1,char *fname2);
  24. void     _Cdecl fill(int srow,int scol,int erow,int ecol,int ch,int atr);
  25. void     _Cdecl filld(int srow,int scol,int erow,int ecol,int ch,int atr);
  26. int      _Cdecl getchf(char *valid);
  27. unsigned _Cdecl getktot(int drive);
  28. int      _Cdecl getsf(char *str,int max);
  29. char    *_Cdecl getvol(char drive);
  30. void     _Cdecl gotoxy_(int row,int col);
  31. void     _Cdecl lprintc(int ch);
  32. void     _Cdecl lprints(char *str);
  33. void     _Cdecl lprintsf(char *str,int count);
  34. int      _Cdecl machid(void);
  35. void     _Cdecl mode(int mode_code);
  36. void     _Cdecl printc(int row,int col,int attr,int ch,int count);
  37. void     _Cdecl printcd(int row,int col,int attr,int ch);
  38. void     _Cdecl prints(int row,int col,int attr,char *str);
  39. void     _Cdecl printsd(int row,int col,int attr,char *str);
  40. int      _Cdecl readchat(void);
  41. void     _Cdecl readcur(int *row,int *col);
  42. void     _Cdecl revattr(int count);
  43. void     _Cdecl scrndump(void);
  44. void     _Cdecl setattr(int attr,int count);
  45. void     _Cdecl setcursz(int sline,int eline);
  46. void     _Cdecl sound_(unsigned pitch,unsigned duration);
  47. void     _Cdecl spc(int num);
  48. void     _Cdecl srestore(int *sbuf);
  49. int     *_Cdecl ssave(void);
  50. void     _Cdecl strchg(char *str,char oldch,char newch);
  51. int      _Cdecl strdel(char *substr,char *str);
  52. void     _Cdecl strichg(char *str,char oldch,char newch);
  53. int      _Cdecl stridel(char *substr,char *str);
  54. char    *_Cdecl striinc(char *str1,char *str2);
  55. char    *_Cdecl strinc(char *str1,char *str2);
  56. int      _Cdecl striocc(char *str,int ch);
  57. char    *_Cdecl strmid(char *str,int st_pos,int num_chars);
  58. int      _Cdecl strocc(char *str,int ch);
  59. char    *_Cdecl strsetsz(char **str,int newsize);
  60. int      _Cdecl tabstop(int col,int tabwidth);
  61. unsigned long   _Cdecl timer(void);
  62. int      _Cdecl vidtype(void);
  63. int      _Cdecl wactiv(int whandle);
  64. int      _Cdecl waitkey(void);
  65. void     _Cdecl wclear(void);
  66. void     _Cdecl wclose(void);
  67. void     _Cdecl wclreol(void);
  68. int     *_Cdecl whide(int **wbuf);
  69. int      _Cdecl wgetc(void);
  70. int      _Cdecl wgetchf(char *valid);
  71. void     _Cdecl wgets(char *str);
  72. int      _Cdecl wgetsf(char *str,int max);
  73. int      _Cdecl wgotoxy(int wrow,int wcol);
  74. int      _Cdecl wmove(int nsrow,int nscol);
  75. int      _Cdecl wopen(int srow,int scol,int erow,int ecol,int btype,int attr);
  76. int      _Cdecl wprintc(int wrow,int wcol,int attr,int ch);
  77. int      _Cdecl wprints(int wrow,int wcol,int attr,char *str);
  78. void     _Cdecl wputc(int ch);
  79. void     _Cdecl wputs(char *str);
  80. void     _Cdecl wputsf(char *str,int width);
  81. void     _Cdecl wrestore(int *wbuf);
  82. int     *_Cdecl wsave(int srow,int scol,int erow,int ecol);
  83. int      _Cdecl wsize(int nerow,int necol);
  84. void     _Cdecl wscroll(int count,int direction);
  85.  
  86.                                         /*  structure of window records      */
  87. struct  _wrecord {
  88.     int *wbuf;                          /*  address of window's buffer       */
  89.     int whandle;                        /*  window's handle                  */
  90.     unsigned char row;                  /*  window's current row             */
  91.     unsigned char column;               /*  window's current column          */
  92.     unsigned char attr;                 /*  window's current text attribute  */
  93.     unsigned char btype;                /*  window's box type                */
  94.     unsigned char wattr;                /*  window's initial text attribute  */
  95. };
  96.  
  97. extern struct _wrecord _wrecord[];      /*  variables used by window mgr  */
  98. extern int _wcurrent;
  99. extern int _whandle;
  100.  
  101.                                         /*  return codes from SOME of
  102.                                             the windowing functions     */
  103. #define W_NOERR     0                   /*  no error                    */
  104. #define W_ALLOCERR  1                   /*  memory allocation error     */
  105. #define W_NOTFOUND  2                   /*  window handle not found     */
  106. #define W_NOACTIVE  3                   /*  no active (open) windows    */
  107. #define W_INVCOORD  4                   /*  invalid coordinates         */
  108. #define W_ESCPRESS  5                   /*  Escape key was pressed      */
  109.  
  110. #define DOWN        0                   /*  for wscroll() function  */
  111. #define UP          1
  112.  
  113. #define MDA         0                   /*  display adapter types  */
  114. #define CGA         1
  115. #define EGA         2
  116.                                         /*  keyboard status definitions  */
  117. #define RSHIFT      1                   /*  right shift pressed          */
  118. #define LSHIFT      2                   /*  left shift pressed           */
  119. #define CTRL        4                   /*  <Ctrl> pressed               */
  120. #define ALT         8                   /*  <Alt> pressed                */
  121. #define SCRLOCK     16                  /*  <Scroll Lock> toggled        */
  122. #define NUMLOCK     32                  /*  <Num Lock> toggled           */
  123. #define CAPSLOCK    64                  /*  <Caps Lock> toggled          */
  124. #define INS         128                 /*  <Ins> toggled                */
  125.  
  126. #ifndef BLACK
  127. #define BLACK       0                   /*  foreground colors  */
  128. #define BLUE        1
  129. #define GREEN       2
  130. #define CYAN        3
  131. #define RED         4
  132. #define MAGENTA     5
  133. #define BROWN       6
  134. #define YELLOW      14
  135. #define WHITE       15
  136. #endif
  137. #define LGREY       7                   /*  TCXL abbreviates LIGHT as L    */
  138. #define DGREY       8                   /*  and DARK as D for ease of use  */
  139. #define LBLUE       9
  140. #define LGREEN      10
  141. #define LCYAN       11
  142. #define LRED        12
  143. #define LMAGENTA    13
  144.  
  145. #define _BLACK      0                   /*  background colors  */
  146. #define _BLUE       16
  147. #define _GREEN      32
  148. #define _CYAN       48
  149. #define _RED        64
  150. #define _MAGENTA    80
  151. #define _BROWN      96
  152. #define _LGREY      112
  153.  
  154. #define BLINK       128                 /*  blinking attribute  */
  155.  
  156. #define BEL         7                   /*  control characters  */
  157. #define BS          8
  158. #define HT          9
  159. #define LF          10
  160. #define FF          12
  161. #define CR          13
  162. #define ESC         27
  163.  
  164. #define NO          0                   /*  Boolean conditions  */
  165. #define YES         1
  166. #define FALSE       0
  167. #define TRUE        1
  168. #define OFF         0
  169. #define ON          1
  170.  
  171.                                         /*  for machid() function  */
  172. #define IBMPC       255                 /*  IBM PC                 */
  173. #define IBMPCXT     254                 /*  IBM PC/XT              */
  174. #define IBMPCJR     253                 /*  IBM PCjr               */
  175. #define IBMPCAT     252                 /*  IBM PC/AT              */
  176. #define IBMCONV     249                 /*  IBM PC Convertible     */
  177. #define SPERRYPC    48                  /*  Sperry PC              */
  178.  
  179. #define KBFLAG      0,0x417            /*  seg,ofs address of keyboard flag  */
  180.  
  181. #define attrib(f,b,i,bl)    ((b<<4)|(f)|(i<<3)|(bl<<7))
  182. #define capsoff()           poke(KBFLAG,peek(KBFLAG)&191)
  183. #define capson()            poke(KBFLAG,peek(KBFLAG)|64)
  184. #define clearkeys()         while(kbhit()) getch()
  185. #define clrwin(a,b,c,d)     gotoxy_(a,b);fill(a,b,c,d,' ',(readchat()>>8))
  186. #define cls()               clrscrn()
  187. #define fhide(a)            _chmod(a,1,2)
  188. #define gameport(a)         ((a&4096)>>12)
  189. #define home()              gotoxy_(0,0)
  190. #define kbstat()            peek(KBFLAG)
  191. #define lcrlf()             lprintc(CR);lprintc(LF)
  192. #define mathchip(a)         ((a&2)>>1)
  193. #define numflop(a)          (((a&192)>>6)+1)
  194. #define numoff()            poke(KBFLAG,peek(KBFLAG)&223)
  195. #define numon()             poke(KBFLAG,peek(KBFLAG)|32)
  196. #define numpar(a)           (((unsigned)(a&-16384))>>14)
  197. #define numser(a)           ((a&3584)>>9)
  198. #define prompts(pr,st)      cputs(pr);gets(st)
  199. #define strleft(st,nu)      strmid(st,0,nu)
  200. #define strright(st,nu)     strmid(st,strlen(st)-nu,nu)
  201. #define wtextattr(a)        _wrecord[_wcurrent].attr=a
  202. #define wunhide(a)          whide(a)
  203. 
  204.